package solutions;

/*

If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.

If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?

NOTE: Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.


21124

*/
public class Euler017 {

	public static void main(String[] args) {
		
		final int ONE = "one".length();
		final int TWO = "two".length();
		final int THREE = "three".length();
		final int FOUR = "four".length();
		final int FIVE = "Five".length();
		final int SIX = "six".length();
		final int SEVEN = "seven".length();
		final int EIGHT = "eight".length();
		final int NINE = "nine".length();
		final int TEN = "ten".length();
		final int ELEVEN = "eleven".length();
		final int TWELVE = "twelve".length();
		final int THIRTEEN = "thirteen".length();
		final int FOURTEEN = "fourteen".length();
		final int FIFTEEN = "fifteen".length();
		final int SIXTEEN = "sixteen".length();
		final int SEVENTEEN = "seventeen".length();
		final int EIGHTEEN = "eighteen".length();
		final int NINETEEN = "nineteen".length();
		
		final int TWENTY = "TWENTY".length();
		final int THIRTY = "Thirty".length();
		final int FOURTY = "Forty".length();
		final int FIFTY = "Fifty".length();
		final int SIXTY = "Sixty".length();
		final int SEVENTY = "Seventy".length();
		final int EIGHTY = "Eighty".length();
		final int NINETY = "Ninety".length();
		
		final int HUNDRED = "hundred".length();
		final int THOUSAND = "thousand".length();
		
		final int AND = "and".length();
		final int _DASH_ = 0;
		

		long result = 0;
		
		result += TEN * 10;
		result += (ELEVEN + TWELVE + THIRTEEN + FOURTEEN + FIFTEEN + SIXTEEN + SEVENTEEN + EIGHTEEN + NINETEEN) * 10;
		result += TWENTY * 10 * 10;
		result += THIRTY * 10 * 10;
		result += FOURTY * 10 * 10;
		result += FIFTY * 10 * 10;
		result += SIXTY * 10 * 10;
		result += SEVENTY * 10 * 10;
		result += EIGHTY * 10 * 10;
		result += NINETY * 10 * 10;
		
		result += HUNDRED * 9 * 100;
		result += AND * 99 * 9;
		result += ONE + THOUSAND;
		
		result += (ONE + TWO + THREE + FOUR + FIVE + SIX + SEVEN + EIGHT + NINE) * 9 * 10 + (ONE + TWO + THREE + FOUR + FIVE + SIX + SEVEN + EIGHT + NINE) * 100;
		
		
		System.out.println("Answer: " + result);
		

	}

}
